/*
 * Copyright 2012 JooKar BV (info@jookar.nl)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.jookar.android.simpleclock.views;

import nl.jookar.android.simpleclock.R;
import nl.jookar.android.simpleclock.SimpleClockApp;

/**
 * This enum class describes all available clock types. 
 * @author Joost A. Bloemsma
 *
 */
public enum ClockType {
	/** One of the clock types. */
	SMOOTH (R.string.smooth_name,R.string.smooth_description, SmoothSwapAnimation.class),
	/** One of the clock types. */
	STANDINGFLIP(R.string.standingflip_name, R.string.standingflip_description, StandingFlipAnimation.class),
	/** One of the clock types. */
	VERTICALROLL(R.string.verticalroll_name, R.string.verticalroll_description, VerticalRollAnimation.class),
	/** One of the clock types. */
	HORIZONTALROLL(R.string.horizontalroll_name, R.string.horizontalroll_description, HorizontalRollAnimation.class);
	
	private final int nameId;
	private final int descrId;
	private final Class<? extends IAnimatedViewSwapper> swapClass;
	
	ClockType(int name, int descr, Class<? extends IAnimatedViewSwapper> swapClass) {
		this.nameId = name;
		this.descrId = descr;
		this.swapClass = swapClass;
	}
	
	/**
	 * Returns the localised name of the clock.
	 * The name is retrieved from the string.xml file
	 * @return The name
	 */
	public String getName() {
		return SimpleClockApp.getAppContext().getString(nameId);
	}
	
	/**
	 * Returns the localised description of the clock.
	 * The description is retrieved from the string.xml file
	 * @return The description
	 */
	public String getDescription() {
		return SimpleClockApp.getAppContext().getString(descrId);
	}
	
	/**
	 * returns the ordinal of this enum, which can be used as a unique identifier
	 * @return int
	 */
	public int getId() {
		return this.ordinal();
	}
	
	/**
	 * returns the class to use for the animation
	 * @return class
	 */
	public Class<? extends IAnimatedViewSwapper> getSwapperClass() {
		return this.swapClass;
	}
}
